

<div class="row">
  <div class="col-md-6">
    <h1>
      File Manager
    </h1>
  </div>
</div>

<div class="row">
  <div class="col-md-12">

    <div class="btn-group">
      <button class="btn btn-default  btn-sm" ng-class="{'btn-primary': listFilter == 'all'}" ng-click="refreshList('all')">
        All
      </button>

      <button class="btn btn-default  btn-sm" ng-class="{'btn-primary': listFilter == 'noVideos'}" ng-click="refreshList('noVideos')">
        Only Non-Associated Files
      </button>

      <button class="btn btn-default  btn-sm" ng-class="{'btn-primary': listFilter == 'noFile'}" ng-click="refreshList('noFile')">
        Only Files that don't exist on Hard-Drive
      </button>

      <button class="btn btn-default  btn-sm" ng-class="{'btn-primary': listFilter == 'onlyFile'}" ng-click="refreshList('onlyFile')">
        Files that only exist on Hard-Drive
      </button>
    </div>

    <button class="btn btn-danger btn-sm pull-right" ng-click="removeMultipleFiles()">
      Delete Multiple Files
    </button>
  </div>

</div>

<div class="margin-top-10">
  <div class="spinner big" ng-show="loading">
    <div class="bounce1"></div>
    <div class="bounce2"></div>
    <div class="bounce3"></div>
  </div>

  <table class="table table-striped file-manager-table" ng-if="activeListDisplay == 'table'">
    <thead>
    <tr>
      <th></th>
      <th>Name</th>
      <th>Uploaded</th>
      <th>Content-Type</th>
      <th>File Exists?</th>
      <th>Associated with</th>
      <th></th>
    </tr>
    </thead>
    <tbody>
    <tr ng-repeat="file in files">
      <td><input type="checkbox" ng-click="addOrRemoveFromSelection($event, file)"/></td>
      <td>
        <div><strong>{{file.originalFilename}}</strong></div>
        <div ng-if="file.src"><a href="{{file.src}}">{{file.src}}</a></div>
        <div ng-if="file.path"><strong>PATH: </strong>{{file.path}}</div>
        <div>{{file.sha256Hex}}</div>
      </td>
      <td>{{file.dateCreated}}</td>
      <td>{{file.contentType}}</td>
      <td>{{file.fileExists}}</td>
      <td>
        <div ng-repeat="video in file.videos"><img width="40px" ng-src="https://image.tmdb.org/t/p/w92/{{video.poster_path}}"/></div>
        <div class="fade-50" ng-if="!file.videos.length">
          None
        </div>
      </td>
      <td style="padding: 6px;">
        <button title="Delete file" class="btn btn-xs btn-danger" ng-click="removeFile(file)"><i class="ion-trash-a"></i></button>
      </td>
    </tr>
    </tbody>
  </table>

  <ul uib-pagination ng-if="filesCount > maxPerPage && files.length < filesCount"
                  max-size="7" force-ellipses="true"
                  boundary-links="true" total-items="filesCount"
                  ng-model="pagination.currentPage" ng-change="pageChanged()"></ul>

</div>

<hr/>



